Kanzi 3.9.10
Project Interface Reference

Create and access nodes and resources. More...

Public Member Functions

Brush CreateBrush (string name, BrushLibrary parent, BrushType brushType)
 Creates a brush in the Brushes library.
 
Brush CreateBrush (string name, BrushLibrary parent, BrushTypeEnum brushType)
 Creates a brush in the Brushes library.
 
Node CreateComponentNode (string name, Node parent, ComponentType componentType)
 Creates a component node.
 
DataSource CreateDataSource (string name, [NotNull] DataSourceType dataSourceType)
 
NodeComponent CreateNodeComponent (string name, NodeComponentHost parent, NodeComponentType nodeComponentType)
 Creates a node component to the specified parent.
 
NodeEffect2D CreateNodeEffect2D (string name, INodeEffect2DContainer parent, NodeEffectType2D nodeEffectType)
 Creates an effect.
 
NodeEffectPrefab2D CreateNodeEffectPrefab2D (string name, NodeEffectType2D nodeEffectType)
 Use effects to apply post-processing effects to 2D nodes.
 
ProjectItem CreateProjectItem (Type projectItemType, string name, ProjectItem parent)
 Creates a project item.
 
T CreateProjectItem< T > (string name, ProjectItem parent)
 Creates a project item.
 
RenderPass CreateRenderPass (string name, IComposerContainer parent, RenderPassType renderPassType)
 Creates a render pass.
 
RenderPassPrefab CreateRenderPassPrefab (string name, RenderPassType renderPassType)
 Creates a render pass prefab.
 
StudioPluginItem CreateStudioPluginItem (string name, [CanBeNull] StudioPluginItem parent, [CanBeNull] string logicFactoryName)
 
PreviewConfigurationGetPreviewConfiguration ()
 Gets the Preview application configuration that Kanzi Studio currently uses.
 
ProjectItem GetProjectItem (string projectItemPath)
 Gets a project item.
 
ProjectItem GetProjectItemByKzbUrl (string kzbUrl, bool searchFromReferencedProjects)
 
IEnumerable< stringGetReferringItemsKzbNames (string propertyTypeName)
 
bool IsAbstract (Type projectItemType)
 

Properties

ProjectItem ActiveComposition [get]
 
AnimationClipLibrary AnimationClipLibrary [get]
 
AnimationLibrary AnimationLibrary [get]
 Gets the Animation Data library which stores all animations in a Kanzi Studio project.
 
ApplicationConfigurationResourceFileDirectory ApplicationDirectory [get]
 
Asset3DImportSourceDirectory Asset3DImportSourceDirectory [get]
 
string BinaryExportDirectory [get]
 
BinaryShaderFormatLibrary BinaryShaderFormatLibrary [get]
 
BrushLibrary BrushLibrary [get]
 Gets the Brushes library which stores brushes used in a Kanzi Studio project.
 
BrushTypeLibrary BrushTypeLibrary [get]
 Gets the brush types available in a Kanzi Studio project.
 
ComponentTypeLibrary ComponentTypeLibrary [get]
 Gets the component node types available in a Kanzi Studio project.
 
DataSourceLibrary DataSourceLibrary [get]
 
DataSourceTypeLibrary DataSourceTypeLibrary [get]
 
EnginePluginLibrary EnginePluginLibrary [get]
 
FontDirectory FontDirectory [get]
 Gets the Fonts directory which contains the fonts in a Kanzi Studio project.
 
FontFamilyLibrary FontFamilyLibrary [get]
 Gets the Font Families library which contains the font families in a Kanzi Studio project.
 
GenericResourceFileDirectory GenericResourceFileDirectory [get]
 Gets the Generic directory which contains the generic resource files in a Kanzi Studio project.
 
IEnumerable< GuideGuides [get]
 Gets the guides in a Kanzi Studio project.
 
ImageDirectory ImageDirectory [get]
 Gets the Images directory which contains the image files in a Kanzi Studio project.
 
bool IsJavaProject [get]
 
bool IsNewlyCreatedProject [get]
 
bool IsSDKProject [get]
 Checks whether this Kanzi Studio project follows the folder structure of a project that uses application code.
 
LocaleLibrary LocaleLibrary [get]
 
MaterialLibrary MaterialLibrary [get]
 Gets the Materials library which contains the materials in a Kanzi Studio project.
 
MaterialTypeLibrary MaterialTypeLibrary [get]
 Gets the Material Types library which contains the material types in a Kanzi Studio project.
 
MeshLibrary MeshLibrary [get]
 Gets the Meshes library which contains the meshes in a Kanzi Studio project.
 
MessageTypeLibrary MessageTypeLibrary [get]
 Gets the message types available in a Kanzi Studio project.
 
NodeComponentTypeLibrary NodeComponentTypeLibrary [get]
 Gets the node component types available in a Kanzi Studio project.
 
NodeEffectPrefab2DLibrary NodeEffectPrefab2DLibrary [get]
 Gets the 2D Effects library which stores the 2D effects in a Kanzi Studio project.
 
NodeEffectType2DLibrary NodeEffectType2DLibrary [get]
 Gets the 2D effect types available in a Kanzi Studio project.
 
PageTransitionCollectionLibrary PageTransitionCollectionLibrary [get]
 Gets the Page Transitions library which contains the page transitions in a Kanzi Studio project.
 
PipelineItemLibrary PipelineItemLibrary [get]
 Gets the Object Sources library which contains the object sources and filters in a Kanzi Studio project.
 
PrefabLibrary PrefabLibrary [get]
 Gets the Prefabs library which contains the prefabs used in a Kanzi Studio project.
 
string PreviewWorkingDirectory [get]
 
ProjectReferenceLibrary ProjectReferenceLibrary [get]
 Gets the Project References library which stores the project references and kzb file references in a Kanzi Studio project.
 
RenderPassPrefabLibrary RenderPassPrefabLibrary [get]
 Gets the Render Pass Prefabs library which stores the render passes used in a Kanzi Studio project.
 
RenderPassTypeLibrary RenderPassTypeLibrary [get]
 Gets the render pass types available in a Kanzi Studio project.
 
Screen Screen [get]
 Gets the Screen node in a Kanzi Studio project.
 
ShaderSourceDirectory ShaderSourceDirectory [get]
 Gets the Shaders directory which stores the shader source files in a Kanzi Studio project.
 
ShortcutLibrary ShortcutLibrary [get]
 Gets the Bookmarks library which stores the bookmarks in a Kanzi Studio project.
 
StateManagerLibrary StateManagerLibrary [get]
 Gets the State Managers library which stores state managers used in a Kanzi Studio project.
 
StudioPluginItemLibrary StudioPluginItemLibrary [get]
 
StyleLibrary StyleLibrary [get]
 Gets the Styles library which stores styles used in a Kanzi Studio project.
 
TagLibrary TagLibrary [get]
 Gets the Tags library which stores tags used in a Kanzi Studio project.
 
TextureLibrary TextureLibrary [get]
 Gets the Textures library which stores textures used in a Kanzi Studio project.
 
ThemeLibrary ThemeLibrary [get]
 
TimelineSequenceLibrary TimelineSequenceLibrary [get]
 
TrajectoryLibrary TrajectoryLibrary [get]
 Gets the Trajectories library which stores trajectories used in a Kanzi Studio project.
 
TriggerActionTypeLibrary TriggerActionTypeLibrary [get]
 Gets the trigger action types available in a Kanzi Studio project.
 

Events

EventHandler< CompositionChangedEventArgsActiveCompositionChanged
 
EventHandler BinaryExported
 Occurs after the export of the kzb file of the project is completed.
 
EventHandler BinaryExporting
 Occurs when the export of the kzb file of the project starts.
 
EventHandler Closing
 
EventHandler< ProjectMergeEventArgsMerged
 
EventHandler< ProjectMergeEventArgsMerging
 
EventHandler< ProjectSavingEventArgsSaved
 Occurs after Kanzi Studio successfully saves the project.
 
EventHandler< ProjectSavingEventArgsSaving
 Occurs when the saving of the project starts.
 

Detailed Description

Create and access nodes and resources.

Use the functions in this class to create nodes and resources in a project and to access the resources in resource libraries in a project.

Member Function Documentation

◆ CreateBrush() [1/2]

Brush CreateBrush ( string name,
BrushLibrary parent,
BrushType brushType )

Creates a brush in the Brushes library.

Parameters
nameThe name of the brush.
parentThe library in which you create the brush.
brushTypeThe type of the brush you create with this function. BrushTypeLibrary stores the brush types available in a Kanzi Studio project.
Returns
The brush you create with this function.
See also
BrushTypeLibrary, BrushLibrary, TextureLibrary, CreateBrush(string, BrushLibrary, BrushTypeEnum), ProjectItemLibrary<T>.GetItemByName(string)

Examples

To create a green Color Brush use this code snippet.
In the Visual Studio solution of your plugin, in the Solution Explorer right-click the project name, select Add Reference, and add the reference to the PresentationCore assembly. Your plugin uses this assembly to define the color you use to set the Brush Color property of the Color Brush.

{
// Get the Brushes library in the Library > Materials and Textures which stores all the Brushes in a Kanzi Studio project.
var brushLibrary = studio.ActiveProject.BrushLibrary;
// Create a Color Brush named Green in the Brushes library.
var colorBrush = studio.ActiveProject.CreateBrush(
brushLibrary.GenerateUniqueChildName("Green"),
studio.ActiveProject.BrushTypeLibrary.GetItemByName(BrushTypeNames.ColorBrush));
// Set the Brush Color property of the Color Brush to green (A=255, R=0, G=255, B=0).
colorBrush.Set(colorBrush.PropertyTypes.ColorBrushColor, System.Windows.Media.Color.FromArgb(255, 0, 255, 0));
}

To create a function that creates texture brushes that use PNG images from a directory:

// For example, to create texture brushes which use images in the
// <KanziInstallationDirectory>\Studio\Asset Library\AssetPackages\Coverflow\Tool_project\Images directory,
// use CreateTextureBrush("../Asset Library/AssetPackages/Coverflow/Tool_project/Images").
private void CreateTextureBrush(string directory)
{
// Get the names of all PNG files in the directory that you pass to this function.
// To use this function, in the class library file that implements the PluginCommand interface add the using directive for the System.IO namespace.
var pngFiles = Directory.GetFiles(directory, "*.png").Select(x => Path.GetFileName(x)).ToArray();
// Get the Library > Materials and Textures > Textures library which stores all the textures in a Kanzi Studio project.
var textureLibrary = studio.ActiveProject.TextureLibrary;
// Get the Library > Materials and Textures > Brushes library which stores all the brushes in a Kanzi Studio project.
var brushLibrary = studio.ActiveProject.BrushLibrary;
// Create a Texture Brush for each of the images.
foreach (var pngFile in pngFiles)
{
// Get the name of a file without the extension.
var resourceName = Path.GetFileNameWithoutExtension(pngFile);
// Import the image file to the Library > Resource Files > Images directory and create a Single Texture that uses this image.
// To import an image without creating a texture, set the second parameter of the ImportImages command to false.
studio.Commands.ImportImages(studio.ActiveProject, Path.Combine(directory, pngFile), true);
// Get the texture you created.
// Create a Texture Brush in the Library > Materials and Textures > Brushes and name it after the texture.
var myTextureBrush = studio.ActiveProject.CreateBrush(
brushLibrary.GenerateUniqueChildName(resourceName),
studio.ActiveProject.BrushTypeLibrary.GetItemByName(BrushTypeNames.TextureBrush));
// Set the Brush Texture property of the Texture Brush to the texture you created.
myTextureBrush.Set(myTextureBrush.PropertyTypes.TextureBrushRenderTexture.Name, texture);
}
}

◆ CreateBrush() [2/2]

Brush CreateBrush ( string name,
BrushLibrary parent,
BrushTypeEnum brushType )

Creates a brush in the Brushes library.

You can use this function to create brushes of types that come with Kanzi Studio.

Parameters
nameThe name of the brush.
parentThe library in which you create the brush.
brushTypeThe type of the brush you create with this function. Use BrushTypeEnum.COLOR for Color Brush, BrushTypeEnum.CONTENT for Content Brush, BrushTypeEnum.MATERIAL for Material brush, and BrushTypeEnum.TEXTURE for Texture Brush.
Returns
The brush you create with this function.
See also
CreateBrush(string, BrushLibrary, BrushType), BrushLibrary

Examples

To create a green Color Brush use this code snippet.
In the Visual Studio solution of your plugin, in the Solution Explorer right-click the project name, select Add Reference, and add the reference to the PresentationCore assembly. Your plugin uses this assembly to define the color you use to set the Brush Color property of the Color Brush.

{
// Get the Brushes library in the Library > Materials and Textures which stores all the Brushes in a Kanzi Studio project.
var brushLibrary = studio.ActiveProject.BrushLibrary;
// Create a Color Brush named Green in the Brushes library.
var colorBrush = studio.ActiveProject.CreateBrush(brushLibrary.GenerateUniqueChildName("Green"), brushLibrary, BrushTypeEnum.COLOR);
// Set the Brush Color property of the Color Brush to green (A=255, R=0, G=255, B=0).
colorBrush.Set(colorBrush.PropertyTypes.ColorBrushColor, System.Windows.Media.Color.FromArgb(255, 0, 255, 0));
}

◆ CreateComponentNode()

Node CreateComponentNode ( string name,
Node parent,
ComponentType componentType )

Creates a component node.

Parameters
nameThe name of the node.
parentThe parent node of the node you create with this function.
componentTypeThe component type of the node.
Returns
The component node you create with this function.
See also
ComponentTypeLibrary

Examples

To create component nodes:

{
// Get the component type library which contains the Kanzi component node types.
var componentTypeLibrary = studio.ActiveProject.ComponentTypeLibrary;
// Get the Scene node in the Screens/Screen/RootPage/Viewport 2D node.
var scene = studio.ActiveProject.GetProjectItem("Screens/Screen/RootPage/Viewport 2D").GetChild<Scene>("Scene");
// In the Scene node create a Button 3D node named My Button.
studio.ActiveProject.CreateComponentNode(
scene.GenerateUniqueChildName("My Button"), scene, componentTypeLibrary.GetComponentType(ComponentTypeNames.Button3D));
// In the Scene node create a Grid List Box 3D node named My Grid List Box.
studio.ActiveProject.CreateComponentNode(
scene.GenerateUniqueChildName("My Grid List Box 3D"), scene, componentTypeLibrary.GetComponentType(ComponentTypeNames.GridListBox3D));
// In the Scene node create a Scroll View 3D node named My Scroll View.
studio.ActiveProject.CreateComponentNode(
scene.GenerateUniqueChildName("My Scroll View"), scene, componentTypeLibrary.GetComponentType(ComponentTypeNames.ScrollView3D));
// In the Scene node create a Stack Layout 3D node named My Stack Layout.
studio.ActiveProject.CreateComponentNode(
scene.GenerateUniqueChildName("My Stack Layout"), scene, componentTypeLibrary.GetComponentType(ComponentTypeNames.StackLayout3D));
}

◆ CreateNodeComponent()

NodeComponent CreateNodeComponent ( string name,
NodeComponentHost parent,
NodeComponentType nodeComponentType )

Creates a node component to the specified parent.

Parameters
nameThe name of the node component.
parentThe NodeComponentHost in which you want to create the node component.
nodeComponentTypeThe type of the node component you create with this function. NodeComponentTypeLibrary stores the node component types available in a Kanzi Studio project.
Returns
The node component you create with this function.
See also
NodeComponentTypeLibrary, NodeComponentHost.CreateNodeComponent(string, NodeComponentType), NodeComponentHost.CreateNodeComponent(NodeComponent), ProjectItemLibrary<T>.GetItemByName(string)

Examples

To create a node component:

{
// Get the RootPage node in the Screens/Screen node.
var rootPage = studio.ActiveProject.GetProjectItem("Screens/Screen").GetChild<Page>("RootPage");
// Get the Animation Player node component type.
var animationPlayerType = studio.ActiveProject.NodeComponentTypeLibrary.GetItemByName(NodeComponentTypeNames.AnimationPlayer);
// Create an Animation Player named Root Animation Player in the RootPage node.
var animationPlayer = studio.ActiveProject.CreateNodeComponent(
rootPage.GenerateUniqueChildName("Root Animation Player"), rootPage, animationPlayerType);
}

◆ CreateNodeEffect2D()

NodeEffect2D CreateNodeEffect2D ( string name,
INodeEffect2DContainer parent,
NodeEffectType2D nodeEffectType )

Creates an effect.

Use effects to apply post-processing effects to 2D nodes. This function creates the effect as child of an INodeEffect2DContainer, such as the NodeEffectPrefab2D.

Parameters
nameThe name of the effect.
parentThe parent effect container of the node effect that you create with this function.
nodeEffectTypeThe type of the node effect. NodeEffectType2DLibrary stores the node effect types available in a Kanzi Studio project.
Returns
The node effect that you create with this function.
See also
CreateNodeEffectPrefab2D, NodeEffectType2DLibrary, ProjectItemLibrary<T>.GetItemByName(string)

Examples

To replace the node effect of an existing node effect prefab:

// This example replaces the root of a shadow effect prefab with a blur effect and assigns the prefab to a 2D node.
{
// Get the Shadow Effect 2D type.
var shadowEffectType = studio.ActiveProject.NodeEffectType2DLibrary.GetItemByName(NodeEffectType2DNames.ShadowEffect2D);
// Get the Blur Effect 2D type.
var blurEffectType = studio.ActiveProject.NodeEffectType2DLibrary.GetItemByName(NodeEffectType2DNames.BlurEffect2D);
// Create a Shadow Effect 2D effect in the Library > 2D Effects.
var effectPrefab = studio.ActiveProject.CreateNodeEffectPrefab2D(
studio.ActiveProject.GenerateUniqueChildName("Shadow Effect"), shadowEffectType);
// Delete the root shadow effect.
effectPrefab.RootNodeEffect2D.Delete();
// Create a Blur Effect 2D in place of the Shadow Effect 2D that you deleted.
studio.ActiveProject.CreateNodeEffect2D(
studio.ActiveProject.GenerateUniqueChildName("Blur Effect"), effectPrefab, blurEffectType);
// Get the Screens/Screen/RootPage/Viewport 2D node.
var viewportNode = studio.ActiveProject.GetProjectItem("Screens/Screen/RootPage/Viewport 2D");
// Set the Effect Prefab property of the Viewport 2D node to the node effect prefab that you created.
viewportNode.Set(Properties.Node2DEffectPrefab.Name, effectPrefab);
}

◆ CreateNodeEffectPrefab2D()

NodeEffectPrefab2D CreateNodeEffectPrefab2D ( string name,
NodeEffectType2D nodeEffectType )

Use effects to apply post-processing effects to 2D nodes.

This function creates the effect prefabs in the 2D Effects library of a Kanzi Studio project.

Parameters
nameThe name of the node effect prefab.
nodeEffectTypeThe type of the node effect. NodeEffectType2DLibrary stores the node effect types available in a Kanzi Studio project.
Returns
The node effect prefab that you create with this function.
See also
CreateNodeEffect2D, NodeEffectType2DLibrary, ProjectItemLibrary<T>.GetItemByName(string)

Examples

To create a node effect prefab:

// This example creates a shadow effect and assigns it to a 2D node.
{
// Get the Shadow Effect 2D type.
var shadowEffectType = studio.ActiveProject.NodeEffectType2DLibrary.GetItemByName(NodeEffectType2DNames.ShadowEffect2D);
// Create a Shadow Effect 2D effect in the Library > 2D Effects.
var shadowEffectPrefab = studio.ActiveProject.CreateNodeEffectPrefab2D(
studio.ActiveProject.GenerateUniqueChildName("Shadow Effect"), shadowEffectType);
// Get the root shadow effect.
var shadowEffect = shadowEffectPrefab.RootNodeEffect2D;
// Set the value of the Shadow Distance property to 15.
shadowEffect.Set(Properties.ShadowEffect2DDistance, 15);
// Get the Screens/Screen/RootPage/Viewport 2D node.
var viewportNode = studio.ActiveProject.GetProjectItem("Screens/Screen/RootPage/Viewport 2D");
// Set the Effect Prefab property of the Viewport 2D node to the node effect prefab that you created.
viewportNode.Set(Properties.Node2DEffectPrefab.Name, shadowEffectPrefab);
}

◆ CreateProjectItem()

ProjectItem CreateProjectItem ( Type projectItemType,
string name,
ProjectItem parent )

Creates a project item.

Use this function to create Kanzi nodes and resources.

Parameters
projectItemTypeThe type of the item.
nameThe name of the item.
parentThe parent item of the item you create with this function.
Returns
The item you create with this function.
See also
ChildContainer.GenerateUniqueChildName, CreateProjectItem<T>(string, ProjectItem), GetProjectItem

Examples

To create five Page nodes in the RootPage node:

{
// Get the Screens/Screen/RootPage node.
var rootPage = studio.ActiveProject.GetProjectItem("Screens/Screen/RootPage");
// Create five Page nodes in the RootPage node.
var count = "";
for (var i = 1; i <= 5; i++)
{
count = i.ToString();
studio.ActiveProject.CreateProjectItem(typeof(Page), rootPage.GenerateUniqueChildName("Page " + count), rootPage);
}
// Print "Created 5 Page nodes in the RootPage node" to the Kanzi Studio Log window.
studio.Log("Created " + count + " " + typeof(Page).Name + " nodes in the " + rootPage.Name + " node");
}

◆ CreateProjectItem< T >()

T CreateProjectItem< T > ( string name,
ProjectItem parent )

Creates a project item.

Use this function to create Kanzi nodes and resources.

Template Parameters
TThe type of the item you want to create with this function.
Parameters
nameThe name of the item.
parentThe parent item of the item you create with this function.
Returns
The item you create with this function.
See also
ChildContainer.GenerateUniqueChildName, CreateProjectItem(Type, string, ProjectItem), GetProjectItem

Examples

To create a function which creates an Empty Node 2D:

// This example shows how you can create a function which creates an Empty Node 2D node as a child node of the node,
// location of which you pass as a parameter. For example, you can prompt the user to provide the path of the parent node,
// or use the GetProjectItem function to get the parent node.
{
// Create an Empty Node 2D node. You use the Project as a factory.
// The first parameter defines the name of the node. Use the GenerateUniqueChildName function,
// because the names of sibling nodes must be unique. The second parameter defines the location
// of the parent node of the Empty Node 2D node you create. You pass this parameter to the
// CreateEmptyNode2D function when you call it.
var emptyNode2D = studio.ActiveProject.CreateProjectItem<EmptyNode2D>(parentNode.GenerateUniqueChildName("Empty Node 2D"), parentNode);
// Make the Empty Node 2D 300 pixels high by setting its Layout Height property.
emptyNode2D.Set(emptyNode2D.PropertyTypes.NodeHeight, 300.0f);
// Make the Empty Node 2D 400 pixels wide by setting its Layout Width property.
emptyNode2D.Set(emptyNode2D.PropertyTypes.NodeWidth, 400.0f);
return emptyNode2D;
}
Type Constraints
T :ProjectItem 

◆ CreateRenderPass()

RenderPass CreateRenderPass ( string name,
IComposerContainer parent,
RenderPassType renderPassType )

Creates a render pass.

Use this function to create render passes of different types in the Render Pass Prefabs library of a Kanzi Studio project.

Parameters
nameThe name of the render pass.
parentThe parent render pass of the render pass you create with this function.
renderPassTypeThe type of the render pass. RenderPassTypeLibrary stores the render pass types available in a Kanzi Studio project.
Returns
The render pass you create with this function.
See also
CreateRenderPassPrefab, RenderPassTypeLibrary, ProjectItemLibrary<T>.GetItemByName(string)

Examples

To create a basic set of render passes which first clear depth and then draw all the content of the scene:

// This example creates a render pass prefab that contains this hierarchy of render passes:
// - Group Render Pass
// - Clear Render Pass
// - Gather Lights Render Pass
// - Draw Objects Render Pass
// It then sets Kanzi Studio to render the Screens/Screen/RootPage/Viewport 2D node using the Group Render Pass.
{
// Get the Group Render Pass render pass type.
var groupRenderPassType = studio.ActiveProject.RenderPassTypeLibrary.GetItemByName(RenderPassTypeNames.RenderPass);
// Create a Group Render Pass render pass prefab in the Library > Rendering > Render Pass Prefabs.
var groupRenderPassPrefab = studio.ActiveProject.CreateRenderPassPrefab(
studio.ActiveProject.GenerateUniqueChildName("Group Render Pass"), groupRenderPassType);
// Get the root render pass of the render pass prefab that you created.
// Get the Clear Render Pass render pass type.
var clearRenderPassType = studio.ActiveProject.RenderPassTypeLibrary.GetItemByName(RenderPassTypeNames.ClearRenderPass);
// Create a Clear Render Pass in the Group Render Pass that you created.
var clearRenderPass = studio.ActiveProject.CreateRenderPass(
groupRenderPass.GenerateUniqueChildName("Clear Render Pass"), groupRenderPass, clearRenderPassType);
// Get the Gather Lights Render Pass render pass type.
var gatherLightsRenderPassType = studio.ActiveProject.RenderPassTypeLibrary.GetItemByName(RenderPassTypeNames.GatherLightsRenderPass);
// Create a Gather Lights Render Pass in the Group Render Pass that you created.
var gatherLightsRenderPass = studio.ActiveProject.CreateRenderPass(
groupRenderPass.GenerateUniqueChildName("Gather Lights Render Pass"), groupRenderPass, gatherLightsRenderPassType);
// Get the Draw Objects Render Pass render pass type.
var drawObjectsRenderPassType = studio.ActiveProject.RenderPassTypeLibrary.GetItemByName(RenderPassTypeNames.DrawObjectsRenderPass);
// Create a Draw Objects Render Pass in the Gather Lights Render Pass that you created.
var drawObjectsRenderPass = studio.ActiveProject.CreateRenderPass(
gatherLightsRenderPass.GenerateUniqueChildName("Draw Objects Render Pass"), gatherLightsRenderPass, drawObjectsRenderPassType);
// Get the Screens/Screen/RootPage/Viewport 2D node.
var viewportNode = studio.ActiveProject.GetProjectItem("Screens/Screen/RootPage/Viewport 2D");
// Set the Render Pass Prefab property of the Viewport 2D node to the render pass prefab that you created.
viewportNode.Set(Properties.Viewport2DRenderPassPrefab.Name, groupRenderPassPrefab);
}

To create render passes which render to a composition target and draw that to the screen use this code snippet.
In the Visual Studio solution of your plugin, in the Solution Explorer right-click the project name, select Add Reference, and add the reference to the PresentationCore assembly. Your plugin uses this assembly to define the color you use to set the Clear Color property for a Clear Render Pass.

// This example creates a render pass prefab that contains this hierarchy of render passes:
// - Group Render Pass
// - Composition Target Render Pass
// - Clear Render Pass which clears the color buffer with transparent black color
// - Gather Lights Render Pass which collects the light nodes
// - Draw Objects Render Pass which draws all content
// - Blit Render Pass which draws the Composition Target Render Pass to the screen
// It then creates a Sphere node in the Screens/Screen/RootPage/Viewport 2D/Scene node and
// sets Kanzi Studio to render the Viewport 2D node using the render pass prefab.
// You can create this render pass hierarchy also by using the
{
// Get the Group Render Pass render pass type.
var groupRenderPassType = studio.ActiveProject.RenderPassTypeLibrary.GetItemByName(RenderPassTypeNames.RenderPass);
// Create a Group Render Pass render pass prefab in the Library > Rendering > Render Pass Prefabs.
var groupRenderPassPrefab = studio.ActiveProject.CreateRenderPassPrefab(
studio.ActiveProject.GenerateUniqueChildName("Group Render Pass"), groupRenderPassType);
// Get the root render pass of the render pass prefab that you created.
// Get the Composition Target Render Pass render pass type.
= studio.ActiveProject.RenderPassTypeLibrary.GetItemByName(RenderPassTypeNames.CompositionTargetRenderPass);
// Create a Composition Target Render Pass in the Group Render Pass that you created.
var compositionTargetRenderPass = studio.ActiveProject.CreateRenderPass(
groupRenderPass.GenerateUniqueChildName("Composition Target Render Pass"), groupRenderPass, compositionTargetRenderPassType);
// Get the Clear Render Pass render pass type.
var clearRenderPassType = studio.ActiveProject.RenderPassTypeLibrary.GetItemByName(RenderPassTypeNames.ClearRenderPass);
// Create a Clear Render Pass in the Composition Target Render Pass that you created.
var clearRenderPass = studio.ActiveProject.CreateRenderPass(
compositionTargetRenderPass.GenerateUniqueChildName("Clear Render Pass"), compositionTargetRenderPass, clearRenderPassType);
// In the Clear Render Pass add the Clear Color 0 property and set it to transparent black.
clearRenderPass.PropertyTypes.ClearRenderPassClearColor0, System.Windows.Media.Color.FromArgb(0, 0, 0, 0));
// Get the Gather Lights Render Pass render pass type.
var gatherLightsRenderPassType = studio.ActiveProject.RenderPassTypeLibrary.GetItemByName(RenderPassTypeNames.GatherLightsRenderPass);
// Create a Gather Lights Render Pass in the Composition Target Render Pass that you created.
var gatherLightsRenderPass = studio.ActiveProject.CreateRenderPass(
compositionTargetRenderPass.GenerateUniqueChildName("Gather Lights Render Pass"), compositionTargetRenderPass, gatherLightsRenderPassType);
// Get the Draw Objects Render Pass render pass type.
var drawObjectsRenderPassType = studio.ActiveProject.RenderPassTypeLibrary.GetItemByName(RenderPassTypeNames.DrawObjectsRenderPass);
// Create a Draw Objects Render Pass in the Gather Lights Render Pass that you created.
studio.ActiveProject.CreateRenderPass(
gatherLightsRenderPass.GenerateUniqueChildName("Draw Objects Render Pass"), gatherLightsRenderPass, drawObjectsRenderPassType);
// Get the Blit Render Pass render pass type.
var blitRenderPassType = studio.ActiveProject.RenderPassTypeLibrary.GetItemByName(RenderPassTypeNames.BlitRenderPass);
// Create a Blit Render Pass in the Group Render Pass that you created.
var blitRenderPass = studio.ActiveProject.CreateRenderPass(
groupRenderPass.GenerateUniqueChildName("Blit Render Pass"), groupRenderPass, blitRenderPassType);
// Bind the Texture 0 property of the Blit Render Pass to the Result Texture 0 property of the Composition Target Render Pass.
blitRenderPass.CreateBinding(
Properties.BlitRenderPassTexture0,
"{@../Composition Target Render Pass/CompositionTargetRenderPass.ResultTexture0}");
// Get the Screens/Screen/RootPage/Viewport 2D/Scene node.
var sceneNode = studio.ActiveProject.GetProjectItem("Screens/Screen/RootPage/Viewport 2D/Scene");
// Create a Sphere node in the Scene node.
studio.ActiveProject.CreateProjectItem<SphereMeshNode>(sceneNode.GenerateUniqueChildName("Sphere"), sceneNode);
// Get the Screens/Screen/RootPage/Viewport 2D node.
var viewportNode = studio.ActiveProject.GetProjectItem("Screens/Screen/RootPage/Viewport 2D");
// Set the Render Pass Prefab property of the Viewport 2D node to the render pass prefab that you created.
viewportNode.Set(Properties.Viewport2DRenderPassPrefab.Name, groupRenderPassPrefab);
}

◆ CreateRenderPassPrefab()

RenderPassPrefab CreateRenderPassPrefab ( string name,
RenderPassType renderPassType )

Creates a render pass prefab.

Use this function to create render pass prefabs in the Render Pass Prefabs library of a Kanzi Studio project.

Parameters
nameThe name of the render pass prefab.
renderPassTypeThe type of the render pass. RenderPassTypeLibrary stores the render pass types available in a Kanzi Studio project.
Returns
The render pass prefab you create with this function.
See also
CreateRenderPass, RenderPassTypeLibrary, ProjectItemLibrary<T>.GetItemByName(string)

Examples

To create a render pass prefab that contains a basic set of render passes which first clear depth and then draw all the content of the scene:

// This example creates a render pass prefab that contains this hierarchy of render passes:
// - Group Render Pass
// - Clear Render Pass
// - Gather Lights Render Pass
// - Draw Objects Render Pass
// It then sets Kanzi Studio to render the Screens/Screen/RootPage/Viewport 2D node using the Group Render Pass.
{
// Get the Group Render Pass render pass type.
var groupRenderPassType = studio.ActiveProject.RenderPassTypeLibrary.GetItemByName(RenderPassTypeNames.RenderPass);
// Create a Group Render Pass render pass prefab in the Library > Rendering > Render Pass Prefabs.
var groupRenderPassPrefab = studio.ActiveProject.CreateRenderPassPrefab(
studio.ActiveProject.GenerateUniqueChildName("Group Render Pass"), groupRenderPassType);
// Get the root render pass of the render pass prefab that you created.
// Get the Clear Render Pass render pass type.
var clearRenderPassType = studio.ActiveProject.RenderPassTypeLibrary.GetItemByName(RenderPassTypeNames.ClearRenderPass);
// Create a Clear Render Pass in the Group Render Pass that you created.
var clearRenderPass = studio.ActiveProject.CreateRenderPass(
groupRenderPass.GenerateUniqueChildName("Clear Render Pass"), groupRenderPass, clearRenderPassType);
// Get the Gather Lights Render Pass render pass type.
var gatherLightsRenderPassType = studio.ActiveProject.RenderPassTypeLibrary.GetItemByName(RenderPassTypeNames.GatherLightsRenderPass);
// Create a Gather Lights Render Pass in the Group Render Pass that you created.
var gatherLightsRenderPass = studio.ActiveProject.CreateRenderPass(
groupRenderPass.GenerateUniqueChildName("Gather Lights Render Pass"), groupRenderPass, gatherLightsRenderPassType);
// Get the Draw Objects Render Pass render pass type.
var drawObjectsRenderPassType = studio.ActiveProject.RenderPassTypeLibrary.GetItemByName(RenderPassTypeNames.DrawObjectsRenderPass);
// Create a Draw Objects Render Pass in the Gather Lights Render Pass that you created.
var drawObjectsRenderPass = studio.ActiveProject.CreateRenderPass(
gatherLightsRenderPass.GenerateUniqueChildName("Draw Objects Render Pass"), gatherLightsRenderPass, drawObjectsRenderPassType);
// Get the Screens/Screen/RootPage/Viewport 2D node.
var viewportNode = studio.ActiveProject.GetProjectItem("Screens/Screen/RootPage/Viewport 2D");
// Set the Render Pass Prefab property of the Viewport 2D node to the render pass prefab that you created.
viewportNode.Set(Properties.Viewport2DRenderPassPrefab.Name, groupRenderPassPrefab);
}

◆ GetPreviewConfiguration()

PreviewConfiguration? GetPreviewConfiguration ( )

Gets the Preview application configuration that Kanzi Studio currently uses.

If Kanzi Studio cannot find the build configuration set by the user, Kanzi Studio uses the next available build configuration. The Preview application configuration is not always the same as the one that the user sets in the properties of their Kanzi Studio project. To get the Preview application configuration set by the user, get the values of PreviewDebugReleaseConfiguration and PreviewVisualStudioVersion properties.

Returns
The Preview application configuration that Kanzi Studio currently uses.

◆ GetProjectItem()

ProjectItem GetProjectItem ( string projectItemPath)

Gets a project item.

For example, use this function to get a node in the node tree and then add child nodes to it, or add, set, and modify the values of the node properties.

Parameters
projectItemPathThe path to the project item you want to get.
Returns
The project item at the path you pass to the function.

Examples

To get a project item:

{
// Get the RootPage node in the node tree.
var rootNode = studio.ActiveProject.GetProjectItem("Screens/Screen/RootPage");
}

Property Documentation

◆ AnimationLibrary

AnimationLibrary AnimationLibrary
get

Gets the Animation Data library which stores all animations in a Kanzi Studio project.

After you get the library, you can access and create resources in that library.

Examples

To create an animation in the Animation Data library:

public void Execute(PluginCommandParameter parameter)
{
// Get the Library > Animations > Animation Data library which stores all animations in a Kanzi Studio project.
var animationLibrary = studio.ActiveProject.AnimationLibrary;
// In the Animation Data library create an Animation named My Animation.
var animation = studio.ActiveProject.CreateProjectItem<Animation>(
animationLibrary.GenerateUniqueChildName("My Animation"), animationLibrary);
// In the My Animation animation set Target Property to Node3D.RenderTransformation.
animation.Set(animation.PropertyTypes.AnimationTargetPropertyName, Properties.Node3DRenderTransformation);
// In the My Animation animation set Property Attribute to Translation Y.
animation.Set(animation.PropertyTypes.AnimationTargetPropertyAttribute, AnimationTargetPropertyAttributeEnum.TRANSLATION_Y);
}

◆ BrushLibrary

BrushLibrary BrushLibrary
get

Gets the Brushes library which stores brushes used in a Kanzi Studio project.

After you get the library, you can access and create resources in that library.

The Brushes library in a Kanzi Studio project.

See also
CreateBrush(string, BrushLibrary, BrushType), CreateBrush(string, BrushLibrary, BrushTypeEnum), BrushTypeLibrary, ProjectItemLibrary<T>.GetItemByName(string)

Examples

To get a brush from the Brushes library:

public void Execute(PluginCommandParameter parameter)
{
// Get the Brushes library which stores brushes used in a Kanzi Studio project.
var brushesLibrary = studio.ActiveProject.BrushLibrary;
// Get the DefaultBackground texture brush from the Brushes library.
var defaultBackground = brushesLibrary.GetItemByName("DefaultBackground");
}

◆ BrushTypeLibrary

BrushTypeLibrary BrushTypeLibrary
get

Gets the brush types available in a Kanzi Studio project.

See also
CreateBrush(string, BrushLibrary, BrushType), BrushLibrary, ProjectItemLibrary<T>.Items

Examples

To get the brush types available in a Kanzi Studio project:

public void Execute(PluginCommandParameter parameter)
{
// Get the Brush Type library which stores the brush type available in a Kanzi Studio project.
var brushTypeLibrary = studio.ActiveProject.BrushTypeLibrary;
// Print the available brush types to the Kanzi Studio Log window.
studio.Log("These brush types are available in this Kanzi Studio project:");
foreach (var brushType in brushTypeLibrary.Items)
{
studio.Log(brushType.Name);
}
}

◆ ComponentTypeLibrary

ComponentTypeLibrary ComponentTypeLibrary
get

Gets the component node types available in a Kanzi Studio project.

See also
CreateComponentNode(string, Node, ComponentType)

Examples

To get the available component node types:

public void Execute(PluginCommandParameter parameter)
{
// Get the component type library.
var componentTypeLibrary = studio.ActiveProject.ComponentTypeLibrary;
// Print the available component node types to the Kanzi Studio Log window.
studio.Log("These component nodes are available in this Kanzi Studio project:");
foreach (var componentType in componentTypeLibrary.Items)
{
studio.Log(componentType.Name);
}
}

◆ FontDirectory

FontDirectory FontDirectory
get

Gets the Fonts directory which contains the fonts in a Kanzi Studio project.

After you get the directory, you can access and import fonts.

See also
FontFamilyLibrary

Examples

To import a font file to the Fonts directory and add that font file to a Font Family:

public void Execute(PluginCommandParameter parameter)
{
// Get the Library > Resource Files > Fonts directory which stores all the font files
// in a Kanzi Studio project.
var fontDirectory = studio.ActiveProject.FontDirectory;
// Import the C:\\Temp\exo2-medium.ttf font file to the Fonts directory and add the imported file
// to the Library > Font Families > Exo 2 font family. If the Exo 2 font family does not exist,
// Kanzi Studio creates it.
studio.Commands.ImportFont(fontDirectory, "C:\\Temp\\exo2-medium.ttf");
}

◆ FontFamilyLibrary

FontFamilyLibrary FontFamilyLibrary
get

Gets the Font Families library which contains the font families in a Kanzi Studio project.

After you get the library, you can access and create font families.

See also
FontDirectory

Examples

To create a function that creates a Font Family and adds to it a font file:

// Create a function that creates a Font Family and includes in that Font Family
// the font file that you pass to this function.
private void CreateFontFamily(string name, FontFile fontFile)
{
// Get the Font Families library which stores the font families in a Kanzi Studio project.
var fontFamilyLibrary = studio.ActiveProject.FontFamilyLibrary;
// Create a Font Family in the Font Families library.
var fontFamily = studio.ActiveProject.CreateProjectItem<FontFamily>(
fontFamilyLibrary.GenerateUniqueChildName(name), fontFamilyLibrary);
// Create a list of font files which contains the font file that you pass to this function.
var fontFiles = new List<FontFile>(new FontFile[] { fontFile });
// Set the Font Files property of the Font Family to the font file that you pass to this function.
fontFamily.Set(fontFamily.PropertyTypes.FontFiles, fontFiles);
}

◆ GenericResourceFileDirectory

GenericResourceFileDirectory GenericResourceFileDirectory
get

Gets the Generic directory which contains the generic resource files in a Kanzi Studio project.

After you get the directory, you can access and import files.

Examples

To import a text file to the Generic directory:

public void Execute(PluginCommandParameter parameter)
{
// Get the Library > Resource Files > Generic directory which stores
// all the generic resource files in a Kanzi Studio project.
var genericResourceDirectory = studio.ActiveProject.GenericResourceFileDirectory;
// Import the C:\\Temp\MyFile.xml file to the Generic directory.
// To import multiple files, use commas to separate the file locations.
// You set the last parameter as null because you do not want to import the file to the Textures library.
studio.Commands.ImportResources(new List<string> { "C:\\Temp\\MyFile.xml" }, genericResourceDirectory, null);
}

◆ Guides

IEnumerable<Guide> Guides
get

Gets the guides in a Kanzi Studio project.

Examples

To get the guides in a Kanzi Studio project:

{
// Get the guides in a Kanzi Studio project.
var guides = studio.ActiveProject.Guides;
// Print the name and position of all guides in your project to the Kanzi Studio Log window.
studio.Log("This Kanzi Studio project contains these guides:");
foreach (var guide in guides)
{
studio.Log(guide.Name + ": " + guide.Get(Properties.GuidePosition));
}
}

To create a guide:

{
// Create a guide named VerticalGuide100.
var verticalGuide = studio.ActiveProject.CreateProjectItem<Guide>("VerticalGuide100", null);
// Set the position of the guide on the x axis to 100.
// Note that to create a Vector data type you need to add the using directive for the System.Windows.
verticalGuide.Set(Properties.GuidePosition, new Vector(100, 0));
// To create a vertical guide, set the Rotation property to 1,5708 radians (90 degrees).
verticalGuide.Set(Properties.GuideRotation, (float)Math.PI / 2);
}

◆ ImageDirectory

ImageDirectory ImageDirectory
get

Gets the Images directory which contains the image files in a Kanzi Studio project.

See also
TextureLibrary, CreateBrush(string, BrushLibrary, BrushType)

Examples

To get an image file in the Images directory of a Kanzi Studio project:

public void Execute(PluginCommandParameter parameter)
{
// Get the Images directory which contains the image files in a Kanzi Studio project.
var imageDirectory = studio.ActiveProject.ImageDirectory;
// Get an image file in the Images directory.
var imageFile = imageDirectory.Children.OfType<ImageFile>().First();
// Print the path to the Images directory to the Kanzi Studio Log window.
studio.Log("The image files of this project are stored in " + imageFile.FileSystemParentDirectory);
}

To import an image to the Images directory:

public void Execute(PluginCommandParameter parameter)
{
// Import the C:\\Temp\MyImage.png file to the Library > Resource Files > Images directory
// and create a Single Texture that uses this image. To import an image without creating a texture,
// set the third parameter of the ImportImages command to false.
studio.Commands.ImportImages(studio.ActiveProject, "C:\\Temp\\MyImage.png", true);
}

◆ IsSDKProject

bool IsSDKProject
get

Checks whether this Kanzi Studio project follows the folder structure of a project that uses application code.

If the project follows the folder structure of a project that uses application code, true, otherwise false.

◆ MaterialLibrary

MaterialLibrary MaterialLibrary
get

Gets the Materials library which contains the materials in a Kanzi Studio project.

After you get the library, you can access and create materials.

See also
MaterialTypeLibrary, CreateProjectItem<T>(string, ProjectItem), ProjectItemLibrary<T>.GetItemByName(string)

Examples

To create a material in the Materials library:

public void Execute(PluginCommandParameter parameter)
{
// Get the Library > Materials and Textures > Material Types library
// which stores all the material types in a Kanzi Studio project.
var materialTypeLibrary = studio.ActiveProject.MaterialTypeLibrary;
// In the Material Types library create a Material Type named MyMaterialType.
var myMaterialType = studio.ActiveProject.CreateProjectItem<MaterialType>(
materialTypeLibrary.GenerateUniqueChildName("MyMaterialType"), materialTypeLibrary);
// Get the Library > Materials and Textures > Materials library
// which stores all the materials in a Kanzi Studio project.
var materialLibrary = studio.ActiveProject.MaterialLibrary;
// In the Materials library create a material named MyMaterialTypeMaterial.
var myMaterial = studio.ActiveProject.CreateProjectItem<Material>(
materialLibrary.GenerateUniqueChildName(myMaterialType.Name + "Material"), materialLibrary);
// Set the Material Type property of MyMaterialTypeMaterial to MyMaterialType.
myMaterial.Set(myMaterial.PropertyTypes.MaterialType.Name, materialTypeLibrary.GetItemByName(myMaterialType.Name));
}

◆ MaterialTypeLibrary

MaterialTypeLibrary MaterialTypeLibrary
get

Gets the Material Types library which contains the material types in a Kanzi Studio project.

After you get the library, you can access and create material types.

See also
MaterialLibrary, ShaderSourceDirectory, CreateProjectItem<T>(string, ProjectItem), ProjectItemLibrary<T>.Items

Examples

To get all material types in the Material Types library of a Kanzi Studio project:

public void Execute(PluginCommandParameter parameter)
{
// Get the Library > Materials and Textures > Material Types library
// which stores all the material types in a Kanzi Studio project.
var materialTypeLibrary = studio.ActiveProject.MaterialTypeLibrary;
// Print the name of all material types in your project to the Kanzi Studio Log window.
studio.Log("This Kanzi Studio project contains these material types:");
foreach (var materialType in materialTypeLibrary.Items)
{
studio.Log(materialType.Name);
}
}

To create a function that creates a material type from vertex and fragment shaders:

// Create a function that creates a Material Type and takes as its input the paths to the files
// that contain the vertex and fragment shaders for this material type.
private void CreateMaterialType(string name, string vertexShaderPath, string fragmentShaderPath)
{
// Create a Material Type in the Library > Materials and Textures > Material Types library.
var materialTypeLibrary = studio.ActiveProject.MaterialTypeLibrary;
var materialType = studio.ActiveProject.CreateProjectItem<MaterialType>(
materialTypeLibrary.GenerateUniqueChildName(name), materialTypeLibrary);
// Set the material type you created to use the vertex shader that you pass to the function.
// Read the content of the file which contains the vertex shader code that you want to use.
// To use this function, in the class library file that implements the PluginCommand interface
// add the using directive for the System.IO namespace.
string vertexShaderSource = File.ReadAllText(vertexShaderPath);
// Get the vertex shader of the material type you created.
var vertexShader = materialType.Children.OfType<VertexShader>().First();
// Get the vertex shader source file.
var vertexShaderSourceFile = vertexShader.Get(vertexShader.PropertyTypes.ShaderSourceFile);
// Get the path to the vertex shader source file.
var vertexShaderSourceFileFileSystemPath = vertexShaderSourceFile.FileSystemPath;
if (File.Exists(vertexShaderSourceFileFileSystemPath))
{
// Replace the content of the existing vertex shader with the vertex shader you pass to the function.
File.WriteAllText(vertexShaderSourceFileFileSystemPath, vertexShaderSource);
}
// Set the material type you created to use the fragment shader you pass to the function.
// Use the same approach you used to set the vertex shader.
string fragmentShaderSource = File.ReadAllText(fragmentShaderPath);
var fragmentShader = materialType.Children.OfType<FragmentShader>().First();
var fragmentShaderSourceFile = fragmentShader.Get(fragmentShader.PropertyTypes.ShaderSourceFile);
var fragmentShaderSourceFileFileSystemPath = fragmentShaderSourceFile.FileSystemPath;
if (File.Exists(fragmentShaderSourceFileFileSystemPath))
{
File.WriteAllText(fragmentShaderSourceFileFileSystemPath, fragmentShaderSource);
}
// Create a material which uses the material type you created.
var materialLibrary = studio.ActiveProject.MaterialLibrary;
var material = studio.ActiveProject.CreateProjectItem<Material>(
materialLibrary.GenerateUniqueChildName(name + "Material"), materialLibrary);
material.Set(material.PropertyTypes.MaterialType, materialType);
}

◆ MeshLibrary

MeshLibrary MeshLibrary
get

Gets the Meshes library which contains the meshes in a Kanzi Studio project.

See also
ProjectItemLibrary<T>.Items

Examples

To get the meshes in a Kanzi Studio project:

public void Execute(PluginCommandParameter parameter)
{
// Get the Meshes library which stores all the meshes in a Kanzi Studio project.
var meshLibrary = studio.ActiveProject.MeshLibrary;
// If the project contains meshes, print their names and the number of meshes in the Kanzi Studio Log window.
if (meshLibrary.Items.Any())
{
var count = meshLibrary.Items.Count().ToString();
studio.Log("This Kanzi Studio project contains " + count + " meshes:");
foreach (var mesh in meshLibrary.Items)
{
studio.Log(mesh.Name);
}
}
else
{
studio.Log("This Kanzi Studio project does not contain meshes.");
}
}

◆ MessageTypeLibrary

MessageTypeLibrary MessageTypeLibrary
get

Gets the message types available in a Kanzi Studio project.

See also
ProjectItemLibrary<T>.Items

Examples

To get the message types available in a Kanzi Studio project:

public void Execute(PluginCommandParameter parameter)
{
// Get the Message Type Library which stores all the message types in a Kanzi Studio project.
var messageTypeLibrary = studio.ActiveProject.MessageTypeLibrary;
// Print the available message types to the Kanzi Studio Log window.
studio.Log("These message types are available in this Kanzi Studio project:");
foreach (var messageType in messageTypeLibrary.Items)
{
studio.Log(messageType.Name);
}
}

◆ NodeComponentTypeLibrary

NodeComponentTypeLibrary NodeComponentTypeLibrary
get

Gets the node component types available in a Kanzi Studio project.

See also
CreateNodeComponent, NodeComponentHost, ProjectItemLibrary<T>.Items

Examples

To get the node component types available in Kanzi:

public void Execute(PluginCommandParameter parameter)
{
// Get the node component type library.
var nodeComponentsLibrary = studio.ActiveProject.NodeComponentTypeLibrary;
// Print the available node component types to the Kanzi Studio Log window.
studio.Log("These node component types are available in this Kanzi Studio project:");
foreach (var nodeComponentType in nodeComponentsLibrary.Items)
{
studio.Log(nodeComponentType.Name);
}
}

◆ NodeEffectPrefab2DLibrary

NodeEffectPrefab2DLibrary NodeEffectPrefab2DLibrary
get

Gets the 2D Effects library which stores the 2D effects in a Kanzi Studio project.

After you get the library, you can access and create resources in that library.

See also
NodeEffectType2DLibrary, CreateNodeEffectPrefab2D(string, NodeEffectType2D), CreateNodeEffect2D(string, INodeEffect2DContainer, NodeEffectType2D)

Examples

To get the 2D effects in a Kanzi Studio project:

public void Execute(PluginCommandParameter parameter)
{
// Get the Node Effect Prefab library which stores the 2D effects in a Kanzi Studio project.
var nodeEffectPrefabLibrary = studio.ActiveProject.NodeEffectPrefab2DLibrary;
// Print the name of each node effect prefab root to the Kanzi Studio Log window.
foreach (var nodeEffect in nodeEffectPrefabLibrary.Items)
{
studio.Log(nodeEffect.Name);
}
}

◆ NodeEffectType2DLibrary

NodeEffectType2DLibrary NodeEffectType2DLibrary
get

Gets the 2D effect types available in a Kanzi Studio project.

See also
CreateNodeEffect2D(string, INodeEffect2DContainer, NodeEffectType2D), ProjectItemLibrary<T>.Items

Examples

To get the 2D effect types available in Kanzi:

public void Execute(PluginCommandParameter parameter)
{
// Get the node effect type library.
var nodeEffectTypeLibrary = studio.ActiveProject.NodeEffectType2DLibrary;
// Print the available effect types to the Kanzi Studio Log window.
studio.Log("These 2D effect types are available in this Kanzi Studio project:");
foreach (var nodeEffectType in nodeEffectTypeLibrary.Items)
{
studio.Log(nodeEffectType.Name);
}
}

◆ PageTransitionCollectionLibrary

PageTransitionCollectionLibrary PageTransitionCollectionLibrary
get

Gets the Page Transitions library which contains the page transitions in a Kanzi Studio project.

After you get the library, you can access and create page transitions.

Examples

To create and configure a page transition:

// This example creates a Fade Transition which animates the opacity of the Page nodes
// between which the transition happens.
public void Execute(PluginCommandParameter parameter)
{
// Get the Page Transitions library which stores the page transitions in a Kanzi Studio project.
var pageTransitionsLibrary = studio.ActiveProject.PageTransitionCollectionLibrary;
// Create a Page Transition Collection named My Transition Collection in the Page Transitions library.
var myTransitionCollection = studio.ActiveProject.CreateProjectItem<PageTransitionCollection>(
pageTransitionsLibrary.GenerateUniqueChildName("My Transition Collection"),
pageTransitionsLibrary);
// Get the Page Host node RootPage in the Screens/Screen node.
var rootPage = studio.ActiveProject.GetProjectItem("Screens/Screen").GetChild<PageHost>("RootPage");
// Set the Transition property of the RootPage node to My Transition Collection.
// This way you set the RootPage node to use the page transitions in My Transition Collection.
rootPage.Set(rootPage.PropertyTypes.PageHostTransitions.Name, myTransitionCollection);
// Create three Page nodes in the RootPage node. In each Page node create a Text Block 2D node and
// set the Text property of the Text Block 2D node to the name of its parent Page node.
for (var i = 1; i <= 3; i++)
{
var page = studio.ActiveProject.CreateProjectItem<Page>(
rootPage.GenerateUniqueChildName("Page"),
rootPage);
var textBlock = studio.ActiveProject.CreateProjectItem<TextBlock2D>(
page.GenerateUniqueChildName("Text Block 2D"),
page);
textBlock.Set(textBlock.PropertyTypes.TextConceptText, page.Name);
}
// Get the Page node named Page in the RootPage node.
var pageNode = rootPage.GetChild<Page>("Page");
// Set the Default Subpage property of the RootPage node to the Page node.
rootPage.Set(rootPage.PropertyTypes.PageHostDefaultSubPage, new NodeReference<Node2D>(pageNode));
// Create a Page Transition named Fade Transition in My Transition Collection.
var fadeTransition = studio.ActiveProject.CreateProjectItem<PageTransition>(
myTransitionCollection.GenerateUniqueChildName("Fade Transition"),
myTransitionCollection);
// Configure the Fade Transition:
// Set the Duration property to 200. This way you set the length of the transition to 200 ms.
fadeTransition.Set(fadeTransition.PropertyTypes.PageTransitionDuration, 200);
// Set the From property to the node named Page.
// This way you make the transition apply only when navigating from the node named Page.
fadeTransition.Set(fadeTransition.PropertyTypes.PageTransitionFrom, pageNode.Name);
// Set the To property to *. This way you apply the transition when navigating to all Page nodes.
fadeTransition.Set(fadeTransition.PropertyTypes.PageTransitionTo, "*");
// Set the Direction property to Unidirectional.
// Use the Direction property to set whether the transition applies to the transition
// from the nodes you set in the From property to the nodes you set in the To property,
// or to the transitions from both nodes.
// To set the Direction property of a Page Transition:
// - For Bidirectional use 0.
// This way you apply the transition to the transition from the nodes in the From property to
// the nodes in the To property, and from the nodes in the To property to the nodes in the From property.
// - For Unidirectional use 1.
// This way you apply the transition only to the transition from the nodes in the From property
// to the nodes in the To property.
fadeTransition.Set(fadeTransition.PropertyTypes.PageTransitionDirection, 1);
// Create a Page Transition Animation named Opacity In.
var fadeTransitionInAnimation = studio.ActiveProject.CreateProjectItem<PageTransitionAnimation>(
fadeTransition.GenerateUniqueChildName("Opacity In"),
fadeTransition);
// Configure the Opacity In animation:
// Set the Animation Target property to Page In.
// To set the Animation Target property of a Page Transition Animation:
// - For Page In use 0.
// This way you use the animation when navigating to the set Page or Page Host node.
// - For Page Out use 1.
// This way you use the animation when navigating from the set Page or Page Host node.
fadeTransitionInAnimation.Set(
fadeTransitionInAnimation.PropertyTypes.PageTransitionAnimationAnimationTarget, 0);
// Set the Transition Property to Node.Opacity. This way you animate the Opacity property.
fadeTransitionInAnimation.Set(
fadeTransitionInAnimation.PropertyTypes.PageTransitionAnimationPropertyType,
Properties.NodeOpacity);
// Set the Start Value property to 0.
// This way you set the value of the Transition Property to 0 when the transition animation starts.
fadeTransitionInAnimation.Set(
fadeTransitionInAnimation.PropertyTypes.PageTransitionAnimationStartValue, "0");
// Set the End Value property to 1.
// This way you set the value of the Transition Property to 1 when the transition animation ends.
fadeTransitionInAnimation.Set(
fadeTransitionInAnimation.PropertyTypes.PageTransitionAnimationEndValue, "1");
// Create a Page Transition Animation named Opacity Out.
var fadeTransitionOutAnimation = studio.ActiveProject.CreateProjectItem<PageTransitionAnimation>(
fadeTransition.GenerateUniqueChildName("Opacity Out"),
fadeTransition);
// Configure the Opacity Out animation:
// Set the Animation Target property to Page Out.
fadeTransitionOutAnimation.Set(
fadeTransitionOutAnimation.PropertyTypes.PageTransitionAnimationAnimationTarget, 1);
// Set the Transition Property to Node.Opacity.
fadeTransitionOutAnimation.Set(
fadeTransitionInAnimation.PropertyTypes.PageTransitionAnimationPropertyType,
Properties.NodeOpacity);
// Set the Start Value property to 1.
fadeTransitionOutAnimation.Set(
fadeTransitionInAnimation.PropertyTypes.PageTransitionAnimationStartValue, "1");
// Set the End Value property to 0.
fadeTransitionOutAnimation.Set(
fadeTransitionInAnimation.PropertyTypes.PageTransitionAnimationEndValue, "0");
}

◆ PipelineItemLibrary

PipelineItemLibrary PipelineItemLibrary
get

Gets the Object Sources library which contains the object sources and filters in a Kanzi Studio project.

After you get the library, you can access and create object sources and filters.

See also
TagLibrary

Examples

To create a Tag Filter:

public void Execute(PluginCommandParameter parameter)
{
// Get the Object Sources library in Library > Rendering which stores
// the object sources and filters in a Kanzi Studio project.
var pipeLineItemLibrary = studio.ActiveProject.PipelineItemLibrary;
// Create a Tag Filter named My Tag Filter in the Object Sources library.
var myTagFilter = studio.ActiveProject.CreateProjectItem<TagFilterObjectSource>(
pipeLineItemLibrary.GenerateUniqueChildName("My Tag Filter"),
pipeLineItemLibrary);
// Get the Tags library which stores tags used in a Kanzi Studio project.
var tagsLibrary = studio.ActiveProject.TagLibrary;
// Create a tag named My Tag in the Tags library.
var myTag = studio.ActiveProject.CreateProjectItem<Tag>(
tagsLibrary.GenerateUniqueChildName("My Tag"), tagsLibrary);
// Create a list of tags which contains the My Tag tag.
var tagList = new List<Tag>(new Tag[] { myTag });
// Set the Included Tags property of the My Tag Filter to My Tag.
// This way you set the filter to pick the nodes that have the My Tag tag.
myTagFilter.Set(myTagFilter.PropertyTypes.TagFilterIncludeList, tagList);
}

◆ PrefabLibrary

PrefabLibrary PrefabLibrary
get

Gets the Prefabs library which contains the prefabs used in a Kanzi Studio project.

After you get the library, you can access and create prefabs.

The Prefabs library in a Kanzi Studio project.

See also
CreateProjectItem<T>(string, ProjectItem), CreateProjectItem(Type, string, ProjectItem), GetProjectItem(string)

Examples

To create a prefab in the Prefabs library and instantiate it:

public void Execute(PluginCommandParameter parameter)
{
// Create a prefab template:
// Get the Prefabs library which stores all the prefabs in a Kanzi Studio project.
var prefabsLibrary = studio.ActiveProject.PrefabLibrary;
// In the Prefabs library create a prefab template named My Prefab which can hold 3D nodes.
// For 2D nodes you have to create a 2D prefab template.
var myPrefabTemplate = studio.ActiveProject.CreateProjectItem<Node3DPrefabTemplate>(
prefabsLibrary.GenerateUniqueChildName("My Prefab"), prefabsLibrary);
// Create an Empty Node 3D node named My Prefab as the root node of the prefab.
var rootNode = studio.ActiveProject.CreateProjectItem<EmptyNode>(
myPrefabTemplate.GenerateUniqueChildName(myPrefabTemplate.Name), myPrefabTemplate);
// If the Empty Node 3D node is the root of a 3D prefab template
// print to the Log a message about successful creation of the prefab template.
if (rootNode.Parent.ProjectItemType == typeof(Node3DPrefabTemplate))
{
studio.Log("Created a prefab named " + rootNode.Name);
}
// Create in the prefab a child node:
// Get the component type of the Button 3D node.
var componentType = studio.ActiveProject.ComponentTypeLibrary.GetComponentType(ComponentTypeNames.Button3D);
// Use the component type you just created to create a Button 3D node in the root node of My Prefab.
var button = studio.ActiveProject.CreateComponentNode("Button 3D", rootNode, componentType);
// Instantiate the prefab that you created:
// Get the node where you want to instantiate the prefab.
var instantiateHere = studio.ActiveProject.GetProjectItem("Screens/Screen/RootPage/Viewport 2D/Scene");
// Create the Prefab Placeholder node which instantiates the prefab in the node tree.
var prefabInstance = studio.ActiveProject.CreateProjectItem<Node3DPrefabPlaceholder>(
instantiateHere.GenerateUniqueChildName("Placeholder"), instantiateHere);
// Create a resource reference from the prefab template which you want to instantiate.
// Instantiate the prefab you created by setting the Prefab Template property
// to the prefab template reference you created in the previous line.
prefabInstance.Set(prefabInstance.PropertyTypes.Node3DPrefabPlaceholderTemplate, reference);
}

◆ ProjectReferenceLibrary

ProjectReferenceLibrary ProjectReferenceLibrary
get

Gets the Project References library which stores the project references and kzb file references in a Kanzi Studio project.

See also
ProjectItemLibrary<T>.Items

Examples

To convert all project references to kzb file references:

{
// Get the Project References library which stores all the project references and kzb file references in
// a Kanzi Studio project, iterate through the items in the library, and convert each project reference
// to a kzb file reference.
foreach (var reference in studio.ActiveProject.ProjectReferenceLibrary.Items.OfType<ProjectReferenceItem>())
{
studio.Commands.ConvertProjectReferenceItemToKzbReferenceItem(reference);
}
}

◆ RenderPassPrefabLibrary

RenderPassPrefabLibrary RenderPassPrefabLibrary
get

Gets the Render Pass Prefabs library which stores the render passes used in a Kanzi Studio project.

After you get the library, you can access and create resources in that library.

See also
RenderPassTypeLibrary, CreateRenderPassPrefab(string, RenderPassType), CreateRenderPass(string, IComposerContainer, RenderPassType)

Examples

To get the render pass prefabs in a Kanzi Studio project:

public void Execute(PluginCommandParameter parameter)
{
// Get the Render Pass Prefabs library which stores the render passes used in a Kanzi Studio project.
var renderPassPrefabLibrary = studio.ActiveProject.RenderPassPrefabLibrary;
// Print the name of each render pass prefab root to the Kanzi Studio Log window.
foreach (var renderPass in renderPassPrefabLibrary.Items)
{
studio.Log(renderPass.Name);
}
}

◆ RenderPassTypeLibrary

RenderPassTypeLibrary RenderPassTypeLibrary
get

Gets the render pass types available in a Kanzi Studio project.

See also
CreateRenderPass(string, IComposerContainer, RenderPassType), ProjectItemLibrary<T>.Items

Examples

To get the render pass types available in Kanzi:

{
// Get the render pass type library.
var renderPassTypeLibrary = studio.ActiveProject.RenderPassTypeLibrary;
// Print the available render pass types to the Kanzi Studio Log window.
studio.Log("These render pass types are available in this Kanzi Studio project:");
{
}
}

◆ Screen

Gets the Screen node in a Kanzi Studio project.

The Screen node is the root node of the node tree in Kanzi.

The Screen node.

See also
PluginInterface.Screen.RootNode2D

Examples

To get the Screen node:

public void Execute(PluginCommandParameter parameter)
{
// Get the Screen node.
var screen = studio.ActiveProject.Screen;
// Set the Metrics Type property of the Screen node to Absolute.
screen.Set(screen.PropertyTypes.WindowMetricsType, LengthTypeEnum.ABSOLUTE);
// Set the Width property of the Screen node to 1920.
screen.Set(screen.PropertyTypes.WindowAbsoluteWidth, 1920);
// Set the Height property of the Screen node to 1080.
screen.Set(screen.PropertyTypes.WindowAbsoluteHeight, 1080);
}

◆ ShaderSourceDirectory

ShaderSourceDirectory ShaderSourceDirectory
get

Gets the Shaders directory which stores the shader source files in a Kanzi Studio project.

See also
MaterialTypeLibrary

Examples

To get all shader source files in the Shaders directory of a Kanzi Studio project:

{
// Get the Shaders directory which contains the shader source files in a Kanzi Studio project.
var shaderSourceDirectory = studio.ActiveProject.ShaderSourceDirectory;
// Print the path of all shader source files in your project to the Kanzi Studio Log window.
studio.Log("This Kanzi Studio project contains these shader source files:");
{
studio.Log(shaderFile.FileSystemPath);
}
}

◆ ShortcutLibrary

ShortcutLibrary ShortcutLibrary
get

Gets the Bookmarks library which stores the bookmarks in a Kanzi Studio project.

After you get the library, you can access and create bookmarks.

Examples

To create a bookmark in the Bookmarks library:

{
// Get the Bookmarks library which stores the bookmarks in a Kanzi Studio project.
var bookmarkLibrary = studio.ActiveProject.ShortcutLibrary;
// Get the Screens/Screen/RootPage node.
var rootPage = studio.ActiveProject.GetProjectItem("Screens/Screen/RootPage");
// Create a Button 2D node in the RootPage node.
var button = studio.ActiveProject.CreateProjectItem<Button2D>(
rootPage.GenerateUniqueChildName("Button 2D"), rootPage);
// Create a bookmark named Button 2D in the Bookmarks library.
var buttonBookmark = studio.ActiveProject.CreateProjectItem<Shortcut>(
bookmarkLibrary.GenerateUniqueChildName("Button 2D"),
// Set the Target property of the bookmark to the Button 2D node.
buttonBookmark.Set(buttonBookmark.PropertyTypes.ShortcutTarget, button);
}

◆ StateManagerLibrary

StateManagerLibrary StateManagerLibrary
get

Gets the State Managers library which stores state managers used in a Kanzi Studio project.

After you get the library, you can access and create state managers in that library.

The State Manager library in a Kanzi Studio project.

See also
StateGroup, State, StateObject, StateTransition, ProjectItemLibrary<T>.GetItemByName(string)

Examples

To create a state manager with a state group, state, and a state object in the State Managers library:

{
// Get the State Managers library which stores state managers used in a Kanzi Studio project.
var stateManagerLibrary = studio.ActiveProject.StateManagerLibrary;
// Create a state manager named MyStateManager in the State Managers library.
var myStateManager = studio.ActiveProject.CreateProjectItem<StateManager>(
stateManagerLibrary.GenerateUniqueChildName("MyStateManager"), stateManagerLibrary);
// Create a state group named MyStateGroup in the MyStateManager state manager.
var myStateGroup = studio.ActiveProject.CreateProjectItem<StateGroup>(
myStateManager.GenerateUniqueChildName("MyStateGroup"),
// Create a state named MyState in the MyStateGroup state group.
var myState = studio.ActiveProject.CreateProjectItem<State>(
myStateGroup.GenerateUniqueChildName("MyState"),
// Create a state object named MyStateObject in MyState state.
var myStateObject = studio.ActiveProject.CreateProjectItem<StateObject>(
myState.GenerateUniqueChildName("MyStateObject"),
}

To get a state manager from the State Managers library:

{
// Get the State Managers library which stores state managers used in a Kanzi Studio project.
var stateManagerLibrary = studio.ActiveProject.StateManagerLibrary;
// Create a state manager named MyStateManager in the State Managers library.
studio.ActiveProject.CreateProjectItem<StateManager>(stateManagerLibrary.GenerateUniqueChildName("MyStateManager"), stateManagerLibrary);
// Get a state manager named MyStateManager from the State Managers library.
var myStateManager = stateManagerLibrary.GetItemByName("MyStateManager");
}

◆ StyleLibrary

StyleLibrary StyleLibrary
get

Gets the Styles library which stores styles used in a Kanzi Studio project.

After you get the library, you can access and create resources in that library.

The Styles library in a Kanzi Studio project.

See also
ProjectItem.GetChild(string), ProjectItem.GetChild<T>(string), CreateProjectItem<T>(string, ProjectItem), CreateProjectItem(Type, string, ProjectItem), ProjectItemLibrary<T>.GetItemByName(string)

Examples

To create a named style in the Styles library:

{
// Get the Styles library which stores styles used in a Kanzi Studio project.
var stylesLibrary = studio.ActiveProject.StyleLibrary;
// Create a named style named MyNamedStyle in the Styles library.
var myNamedStyle = studio.ActiveProject.CreateProjectItem<StyleItem>(
stylesLibrary.GenerateUniqueChildName("MyNamedStyle"), stylesLibrary);
}

To create a typed style in the Styles library:

{
// Get the Styles library which stores styles used in a Kanzi Studio project.
var stylesLibrary = studio.ActiveProject.StyleLibrary;
// Create a named style named MyTypedStyle in the Styles library.
var myTypedStyle = studio.ActiveProject.CreateProjectItem<StyleItem>(
stylesLibrary.GenerateUniqueChildName("MyTypedStyle"), stylesLibrary);
// Convert the named style you just created to a typed style
myTypedStyle.Set(myTypedStyle.PropertyTypes.StyleType, StyleTypeEnum.GENERIC);
}

To get a style from the Styles library:

{
// Get the Styles library which stores styles used in a Kanzi Studio project.
var stylesLibrary = studio.ActiveProject.StyleLibrary;
// Create a named style named MyNamedStyle in the Styles library.
studio.ActiveProject.CreateProjectItem<StyleItem>(stylesLibrary.GenerateUniqueChildName("MyNamedStyle"), stylesLibrary);
// Get the named style named MyNamedStyle from the Styles library.
var myNamedStyle = stylesLibrary.GetItemByName("MyNamedStyle");
}

◆ TagLibrary

TagLibrary TagLibrary
get

Gets the Tags library which stores tags used in a Kanzi Studio project.

After you get the library, you can access and create resources in that library.

The Tags library in a Kanzi Studio project.

See also
ProjectItem.GetChild(string), ProjectItem.GetChild<T>(string), CreateProjectItem<T>(string, ProjectItem), CreateProjectItem(Type, string, ProjectItem), ProjectItemLibrary<T>.GetItemByName(string), PipelineItemLibrary

Examples

To get a tag from the Tags library:

{
// Get the Tags library which stores tags used in a Kanzi Studio project.
var tagsLibrary = studio.ActiveProject.TagLibrary;
// Get the default tag Transparent from the Tags library.
var tagTransparent = tagsLibrary.GetItemByName("Transparent");
}

To create a tag in the Tags library:

{
// Get the Tags library which stores tags used in a Kanzi Studio project.
var tagsLibrary = studio.ActiveProject.TagLibrary;
// Create a tag named MyTag in the Tags library.
var tag = studio.ActiveProject.CreateProjectItem<Tag>(tagsLibrary.GenerateUniqueChildName("MyTag"), tagsLibrary);
}

◆ TextureLibrary

TextureLibrary TextureLibrary
get

Gets the Textures library which stores textures used in a Kanzi Studio project.

After you get the library, you can access and create resources in that library.

The Textures library in a Kanzi Studio project.

See also
ProjectItem.GetChild, ProjectItemLibrary<T>.GetItemByName(string)

Examples

To get a texture from the Textures library:

{
// Get the Library > Materials and Textures > Textures library
// which stores all the textures in a Kanzi Studio project.
var texturesLibrary = studio.ActiveProject.TextureLibrary;
// Get the DefaultTexture texture from the Textures library.
var defaultTexture = texturesLibrary.GetItemByName("Default Texture");
}

To create a Single Texture in the Textures library:

{
// Get the Library > Materials and Textures > Textures library.
var textureLibrary = studio.ActiveProject.TextureLibrary;
// Get the DefaultTextureImage.png image in the Images directory of the project.
if (studio.ActiveProject.ImageDirectory.GetChild("DefaultTextureImage.png") is ImageFile defaultImage)
{
// In the Textures library, create a Single Texture named My Single Texture.
var singleTexture = studio.ActiveProject.CreateProjectItem<SingleTexture>(
textureLibrary.GenerateUniqueChildName("My Single Texture"), textureLibrary);
// Set the Image property of the Single Texture to DefaultTextureImage.png.
singleTexture.Set(singleTexture.PropertyTypes.TextureImage, defaultImage);
}
}

To create a function that creates a Single Texture from an image file:

{
// Get the Library > Materials and Textures > Textures library.
var textureLibrary = studio.ActiveProject.TextureLibrary;
// Get the name of the image file without the file extension.
// To use this function, in the class library file that implements the PluginCommand interface add the using directive for the System.IO namespace.
var resourceName = Path.GetFileNameWithoutExtension(path);
// Import the image file to the Library > Resource Files > Images library and create a Single Texture that uses this image file.
// To import an image without creating a texture, set the second parameter of the ImportImages command to false.
studio.Commands.ImportImages(studio.ActiveProject, path, true);
// Get the texture you created.
return texture;
}

To create a Render Target Texture in the Textures library:

{
// Get the Library > Materials and Textures > Textures library.
var textureLibrary = studio.ActiveProject.TextureLibrary;
// In the Textures library, create a Render Target Texture named My Render Target Texture.
var renderTargetTexture = studio.ActiveProject.CreateProjectItem<RenderTargetTexture>(
textureLibrary.GenerateUniqueChildName("My Render Target Texture"), textureLibrary);
// Set the Width and Height properties of the Render Target Texture to 256.
renderTargetTexture.Set(renderTargetTexture.PropertyTypes.RenderTargetTextureWidth, 256);
renderTargetTexture.Set(renderTargetTexture.PropertyTypes.RenderTargetTextureHeight, 256);
}

◆ TrajectoryLibrary

TrajectoryLibrary TrajectoryLibrary
get

Gets the Trajectories library which stores trajectories used in a Kanzi Studio project.

After you get the library, you can access and create resources in that library.

See also
CreateComponentNode

Examples

To create a trajectory in the Trajectories library and set a Trajectory Layout node to use that trajectory:

{
// Get the Trajectories library which contains the trajectories in a Kanzi Studio project.
var trajectoryLibrary = studio.ActiveProject.TrajectoryLibrary;
// In the Trajectories library create a Circle Trajectory named My Circle Trajectory.
var myCircleTrajectory = studio.ActiveProject.CreateProjectItem<CircleTrajectory>(trajectoryLibrary.GenerateUniqueChildName("My Circle Trajectory"), trajectoryLibrary);
// Set the Radius property of My Circle Trajectory to 5.
myCircleTrajectory.Set(Properties.CircleRadius, 5);
// Get the Scene node in the Screens/Screen/RootPage/Viewport 2D node.
var sceneNode = studio.ActiveProject.GetProjectItem("Screens/Screen/RootPage/Viewport 2D").GetChild<Scene>("Scene");
// Get the component type library which contains the Kanzi component node types.
var componentTypeLibrary = studio.ActiveProject.ComponentTypeLibrary;
// In the Scene node create a Trajectory Layout 3D node.
var trajectoryLayout = studio.ActiveProject.CreateComponentNode(
sceneNode.GenerateUniqueChildName("Trajectory Layout 3D"), sceneNode, componentTypeLibrary.GetComponentType(ComponentTypeNames.TrajectoryLayout3D));
// Set the Trajectory property of the Trajectory Layout 3D node to My Circle Trajectory.
trajectoryLayout.Set(Properties.TrajectoryLayoutConceptTrajectory, new ResourceReference<Trajectory>(myCircleTrajectory));
// In the Trajectory Layout 3D node create 8 Sphere nodes.
for (int i = 0; i < 8; i++)
{
studio.ActiveProject.CreateProjectItem(typeof(SphereMeshNode), trajectoryLayout.GenerateUniqueChildName("Sphere"), trajectoryLayout);
}
}

◆ TriggerActionTypeLibrary

TriggerActionTypeLibrary TriggerActionTypeLibrary
get

Gets the trigger action types available in a Kanzi Studio project.

See also
ProjectItemLibrary<T>.Items

Examples

To get the trigger action types available in a Kanzi Studio project:

{
// Get the Trigger Action Type Library which stores all the trigger action types in a Kanzi Studio project.
var triggerActionTypeLibrary = studio.ActiveProject.TriggerActionTypeLibrary;
// Print the available trigger action types to the Kanzi Studio Log window.
studio.Log("These trigger action types are available in this Kanzi Studio project:");
{
}
}

Event Documentation

◆ BinaryExported

EventHandler BinaryExported

Occurs after the export of the kzb file of the project is completed.

Examples

To subscribe to the BinaryExported event:

// Create the event handler and subscribe to the BinaryExported event to get
// notified when Kanzi Studio finishes exporting the kzb file of the project.
{
// Create the event handler that is set off when Kanzi Studio finishes
// exporting the kzb file of the project.
studio.ActiveProject.BinaryExported += Project_BinaryExported;
}
private void Project_BinaryExported(object sender, EventArgs e)
{
// When Kanzi Studio finishes exporting the kzb file of the project,
// print a message to the Kanzi Studio Log window.
studio.Log("Finished exporting the kzb file of the project.");
}

◆ BinaryExporting

EventHandler BinaryExporting

Occurs when the export of the kzb file of the project starts.

Examples

To subscribe to the BinaryExporting event:

// Create the event handler and subscribe to the BinaryExporting event to get
// notified when Kanzi Studio is exporting the kzb file of the project.
{
// Create the event handler that is set off when Kanzi Studio is exporting
// the kzb file of the project.
studio.ActiveProject.BinaryExporting += Project_BinaryExporting;
}
private void Project_BinaryExporting(object sender, EventArgs e)
{
// When Kanzi Studio is exporting the kzb file of the project,
// print a message to the Kanzi Studio Log window.
studio.Log("Exporting the kzb file of the project...");
}